//
//  ADJgSDKRewardVodAdCustomEvent.m
//  AnyThinkSDKDemo
//
//  Created by 刘娟 on 2024/9/25.
//  Copyright © 2024 抽筋的灯. All rights reserved.
//

#import "ADJgSDKRewardVodAdCustomEvent.h"

@interface ADJgSDKRewardVodAdCustomEvent()

@property (nonatomic, assign)BOOL isReward;

@end

@implementation ADJgSDKRewardVodAdCustomEvent

-(void)loadRawardVodWithPosId:(NSString *)posId{
    self->_expressRvAdContainer = [[ADJgSDKRewardVodAdContainer alloc] initPosId:posId delegate:self];
    [self->_expressRvAdContainer loadRewardVodAd];
}

-(void)showFromRootViewController:(UIViewController *)controller{
    [self.expressRvAdContainer showRewardVodAdWithRootViewController:controller];
}

- (void)adjg_rewardvodAdCloseLandingPage:(nonnull ADJgSDKRewardvodAd *)rewardvodAd {
    
}

- (void)adjg_rewardvodAdDidClick:(nonnull ADJgSDKRewardvodAd *)rewardvodAd { 
    [self trackRewardedVideoAdClick];
}

- (void)adjg_rewardvodAdDidClose:(nonnull ADJgSDKRewardvodAd *)rewardvodAd { 
    [self trackRewardedVideoAdCloseRewarded:_isReward extra:nil];
}

- (void)adjg_rewardvodAdDidPlayFinish:(nonnull ADJgSDKRewardvodAd *)rewardvodAd { 
    [self trackRewardedVideoAdVideoEnd];
}

- (void)adjg_rewardvodAdDidRewardEffective:(nonnull ADJgSDKRewardvodAd *)rewardvodAd { 
    _isReward = YES;
    [self trackRewardedVideoAdRewarded];
}

- (void)adjg_rewardvodAdDidVisible:(nonnull ADJgSDKRewardvodAd *)rewardvodAd { 
    [self trackRewardedVideoAdShow];
}

/**
 *  激励视频广告数据请求失败
 */
- (void)adjg_rewardvodAdFailToLoad:(nonnull ADJgSDKRewardvodAd *)rewardvodAd errorModel:(nonnull ADJgAdapterErrorDefine *)errorModel {
    [self.expressRvAdContainer close];
    [self trackRewardedVideoAdLoadFailed:nil];
}

/**
 *  激励视频广告数据请求成功
 */
- (void)adjg_rewardvodAdLoadSuccess:(nonnull ADJgSDKRewardvodAd *)rewardvodAd {
    [self trackRewardedVideoAdLoaded:self.expressRvAdContainer adExtra:nil];
}

- (void)adjg_rewardvodAdPlaying:(nonnull ADJgSDKRewardvodAd *)rewardvodAd errorModel:(nonnull ADJgAdapterErrorDefine *)errorModel { 
    if (errorModel != nil) {
        [self trackRewardedVideoAdPlayEventWithError:nil];
    }
}

- (void)adjg_rewardvodAdReadyToPlay:(nonnull ADJgSDKRewardvodAd *)rewardvodAd { 
    [self trackRewardedVideoAdVideoStart];
}

- (void)adjg_rewardvodAdServerDidFailed:(nonnull ADJgSDKRewardvodAd *)rewardvodAd errorModel:(nonnull ADJgAdapterErrorDefine *)errorModel { 
    
}

- (void)adjg_rewardvodAdServerDidSucceed:(nonnull ADJgSDKRewardvodAd *)rewardvodAd { 
    
}

- (void)adjg_rewardvodAdServerDidSucceed:(nonnull ADJgSDKRewardvodAd *)rewardvodAd info:(nonnull NSDictionary *)info { 
    
}

- (void)adjg_rewardvodAdVideoLoadSuccess:(nonnull ADJgSDKRewardvodAd *)rewardvodAd { 
    
}

- (void)adjg_rewardvodAdWillVisible:(nonnull ADJgSDKRewardvodAd *)rewardvodAd { 
    
}

@end
